/*
 * Copyright(c) 2020-2100 万达信息股份有限公司 版权所有
 * WONDERS INFORMATION CO., LTD. ALL RIGHTS RESERVED.
 */

package com.wondersgroup.v1;

/**
 * 面向对象傻等
 * 等待其他线程触发wakeUp事件
 * @author: huym
 * @version: 1.0
 * @date: 2020/12/10
 */
public class Main {
    public static void main(String[] args) {
        Child child = new Child();
        while (!child.isCry()) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("observing...");
        }
    }
}

class Child{
    private boolean cry = false;
    public boolean isCry(){
        return this.cry;
    }
    public void wakeUp(){
        cry = true;
        System.out.println("waked up! crying wuwuwuwuwu...");
    }
}